UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bkwhbr/040tf5Snqk6Dx95RAWXQGZH34iglVMJr+r50=' 
WHERE 
  key_id = 'be566258e0990c924f75fcf7777aca9a34b2188a816adb41f20c968fdbc60e8c' 
  AND (
    token = 'bkwhbr/040tf5Snqk6Dx95RAWXQGZH34iglVMJr+r50=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053