UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0M6s+y35rtagcDsDWuDAcAjYqaQucFjlSzvE6GjLck=' 
WHERE 
  key_id = '9d030fdf4e23c8fcc41b791813917c480e70698a304438f7856e1a288d096f75' 
  AND (
    token = 'P0M6s+y35rtagcDsDWuDAcAjYqaQucFjlSzvE6GjLck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00239