UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vcLRy+D5nh1yXoU7xxOYSQwgBj89BpY8vXqmDQjL6+8=' 
WHERE 
  key_id = '122abc2730892ffccfd922c011b9eb82518ff3a687bc384a8812ae38cbba3e1b' 
  AND (
    token = 'vcLRy+D5nh1yXoU7xxOYSQwgBj89BpY8vXqmDQjL6+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062