UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dcfhap7LZafpsSBgWPlGkDYXelQXmMgaitrU6Elbl0Q=' 
WHERE 
  key_id = 'd1fb322d29f1ebad2b153649aa40442992395102e5a026388182e74c90ae4752' 
  AND (
    token = 'dcfhap7LZafpsSBgWPlGkDYXelQXmMgaitrU6Elbl0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064