UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oSxxBqlwYW50+MalFO/5BxvpNArbTlu9Du+1fSDxyIQ=' 
WHERE 
  key_id = 'b983785a0c9f4860e61f98a04f3ee862d2d041a5f97c25019cb800c81a83ffe2' 
  AND (
    token = 'oSxxBqlwYW50+MalFO/5BxvpNArbTlu9Du+1fSDxyIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039