UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jmIsMr9D6iVLMhuq2+YPs0mntceksOYvRJdB4L5q+/o=' 
WHERE 
  key_id = '6c622853c76ad9a61c7b106db214822e01a333ba385a7934d832d4127f53926f' 
  AND (
    token = 'jmIsMr9D6iVLMhuq2+YPs0mntceksOYvRJdB4L5q+/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046