UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZaqz5OyQ3hmmeswFh627Ewv4Sl7kbX3nbQoIBvMzPY=' 
WHERE 
  key_id = '4da8d986bd0f6afa70d373324cc1e0bdf45e9aaa26686875ac1214f1ad16238d' 
  AND (
    token = 'RZaqz5OyQ3hmmeswFh627Ewv4Sl7kbX3nbQoIBvMzPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037